<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<button class="btn">点名</button>
		<h3>显示名字</h3>
	<!-- 随机点名：点击网页 -->
	</body>
	<script>
		let btn=document.querySelector('.btn');
		let text=document.querySelector('h3');
		let arr=['a','b','c'];
		btn.addEventListener('click',function(){
			//获取数组的随机索引值num[0~arr.length]
			let num=Math.floor(Math.random()*arr.length);
			//通过num获取数组中的随机值
			text.innerHTML=arr[num];
		})
		
	
	</script>
	
</html>
